package com.ruoyi.workflow.handler;

import lombok.AllArgsConstructor;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

/**
 * 自定义处理类
 *
 * @author KonBAI
 */
@AllArgsConstructor
@Component("customHandler")
public class CustomHandler {
    public Set<String> getIds(DelegateExecution execution) {
        String type = execution.getVariable("type").toString();
        System.out.println("流程参数" + type);

        Set<String> candidateUserIds = new LinkedHashSet<>();
        List<Long> userIds = new ArrayList<>();
        userIds.add(3L);
        // 添加候选用户id
        userIds.forEach(id -> candidateUserIds.add(String.valueOf(id)));
        return candidateUserIds;
    }
}
